import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import fire from '@dfeidao/atom-web/msg/fire';
import a002 from './a002';

export default async function a006(fd: IFeidaoAiBrowserComponent) {
	// todo
	const node_chk = fd.data.node.querySelectorAll('[data-id="list1"]:checked');
	const arr = Array.from(node_chk);
	if (arr.length === 0) {
		alert('请选择一条数据');
	} else {
		const list = arr.map((v) => {
			return JSON.parse(v.getAttribute("data-no"));
		});
		console.log(list);
		const flag = get(fd, 'flag') as string;
		if (flag === 'add') {
			fire('zj-000009', 'a011', list);
		} else {
			fire('zj-000010', 'a008', list);
		}
		// fire('zj-000009', 'a001', list);
		await a002(fd);
	}
}
